package cn.tedu.egmvc2.controller;



import cn.tedu.egmvc2.Mapper.AddressMapepr;
import cn.tedu.egmvc2.pojo.dto.AddressDTO;
import cn.tedu.egmvc2.pojo.entity.Address;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/address/")
public class AddressController {

    @Autowired
    private AddressMapepr addressMapepr;

    @RequestMapping("insert")
    @ResponseBody
    public String insert(Address address){

        addressMapepr.insertAddress(address);
    return "添加成功";
    }

    @RequestMapping("select")
    @ResponseBody
    public List<Address> select(Address address){
        return addressMapepr.selectAddress(address);
    }

    @RequestMapping("delete")
    @ResponseBody
    public String delete(int id){
        addressMapepr.deleteAddress(id);
        return "删除成功";
    }


    @RequestMapping("update")
    @ResponseBody
    public String update(Address address){
        addressMapepr.updateAddress(address);
        return "修改成功";
    }

}
